package com.portal.business.news.action;




import com.portal.business.news.NewsService;
import com.portal.business.news.action.form.NewsSearchForm;
import com.portal.business.news.action.model.NewsModel;
import com.portal.business.news.dto.NewsDTO;
import com.portal.framework.exception.AppException;
import com.portal.framework.webutil.BaseAction;


/**
 * 
 * 项目名称: Portal     
 * 类名称:   NewsAction     
 * 类描述:   咨询动态  (只有查询功能,增删改功能在客服系统后台里调用操作)
 * 创建人:   骆海东
 * 创建时间: Aug 31, 2011 10:15:43 AM     
 * 最后修改人:   骆海东
 * 最后修改时间: Aug 31, 2011 10:15:43 AM     
 * 最后修改备注:
 */
public class NewsAction extends BaseAction {
	    

	private static final long serialVersionUID = -7388698333100612046L;

	private NewsModel model = new NewsModel();
	
	private NewsService newsService;
	
	/**
	 * 明细
	 * 
	 * @return
	 * @throws AppException
	 */
	public String goNewsInfo() {
		Integer newId=Integer.valueOf(this.getRequest().getParameter("newId"));
		NewsDTO newsDTO=this.newsService.findByID(newId);
		this.model.setNewsDTO(newsDTO);
		return SUCCESS;
	}
	
	/**
	 * 查询
	 * 
	 * @return
	 * @throws AppException
	 */
	public String goNewsMain() {
		NewsSearchForm sf=model.getSearchForm();
        //分页查询结果集
	    model.setPagerResult(this.findByCondition(NewsDTO.class, sf));
		return SUCCESS;
	}

	/**
	 * 
	 * 方法名:   goNewsIndex   
	 * 方法描述: 首页展示
	 * 传入参数:  
	 * 返回值类型: String
	 * 异常对象:
	 */
	public String goNewsIndex(){
		 this.getRequest().setAttribute("nDTOs",this.newsService.findIndex());
		return SUCCESS;
	}
	public NewsModel getModel() {
		return model;
	}

	public void setModel(NewsModel model) {
		this.model = model;
	}

	public NewsService getNewsService() {
		return newsService;
	}

	public void setNewsService(NewsService newsService) {
		this.newsService = newsService;
	}

}
